<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>立项列表 （老师）</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=10,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <link rel="stylesheet" type="text/css" href="/lib/layui/layui/css/layui.css"/>
    <script type="text/javascript" src="/js/news/jquery-1.9.1.js"></script>
    <script src="/js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../js/jquery/jquery.cookie.js"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.ui.widget.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.iframe-transport.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.fileupload.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="/js/common/fileupload.js"></script>
    <script type="text/javascript" src="/lib/layui/layui/layui.js"></script>
    <script type="text/javascript" src="/lib/layui/layui/layui.all.js"></script>
</head>
<style>
    .mbox {
        padding: 8px
    }

    .item img {
        height: 40px;
    }

    .btn {
        height: 30px;
    }

    .btn button {
        float: right;
    }

    .information {
        background: #e8f4fc;
        height: 30px;
        line-height: 30px;
    }
    .layui-form-label{
        width: 77px;
    }

</style>
<body>
<div class="mbox">
    <div class="item">
        <img src="../img/yeji.png" alt="" style="margin: 0 5px 0 20px;"> <span
            style="font-size: 22px;display: inline-block;vertical-align: middle;">立项列表 （老师）</span>
    </div>
    <hr class="layui-bg-blue">
    <div class="btn">
        <button type="button" class="layui-btn layui-btn-sm" style="background: #2b7fe0"><i
                class="layui-icon layui-icon-upload-drag" style="background: #2b7fe0"></i>导出Excel
        </button>
        <button type="button" class="layui-btn layui-btn-sm"  style="background: #2b7fe0;margin-right: 20px"><i
                class="layui-icon layui-icon-addition" style="vertical-align: inherit"></i>查询
        </button>
    </div>
    <table class="layui-hide" id="test" lay-filter="test"></table>
</div>
</body>
</html>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="score">查看</a>
</script>
<script>
    layui.use(['table', 'form', 'laydate','upload'], function () {
        var table = layui.table,
            form = layui.form,
            laydate = layui.laydate,
            upload = layui.upload;
        var tableInt =  table.render({
            elem: '#test'
            ,url:'/Recognize/getProjectList'
            ,where:{
                trType:1,
                trStatus:2,
                userId:'立项列表'
            }
            , title: '用户数据表'
            , cols: [[
                {type: 'checkbox', fixed: 'left'}
                , {field: 'topicName', title: '项目名称',templet:function(d){
                        return d.rpmTopic.topicName
                    }}
                , {field: 'planName', title: '申报计划名称',templet:function(d){
                        return d.rpmTopic.planName
                    }}
                , {field: 'name', title: '项目成员',templet:function(d){
                        var rpmSignatures = d.rpmTopic.rpmSignatures;
                        var nameId = ''
                        if(rpmSignatures != undefined){
                            for(var i=0;i<rpmSignatures.length;i++){
                                if(rpmSignatures[i].userName != undefined && rpmSignatures[i].userName != ''){
                                    nameId += rpmSignatures[i].userName + ',';
                                }
                            }
                            return nameId
                        }
                        return '';
                    }}
                , { title: '负责人',templet:function(d){
                        return d.rpmTopic.userName;
                    }}
                , { title: '专家1 评分',templet:function(d){
                        var scoreList = d.rpmTopic.scoreList;
                        if (scoreList != undefined && scoreList.length > 0 && scoreList[0] != undefined){
                            return scoreList[0].rsScore;
                        }
                        return '';
                    }}
                , { title: '专家1 意见',templet:function(d){
                        var scoreList = d.rpmTopic.scoreList;

                        if (scoreList != undefined && scoreList.length > 0 && scoreList[0] != undefined){
                            return scoreList[0].remarks;
                        }
                        return '';
                    }}
                , { title: '专家2 评分',templet:function(d){
                        var scoreList = d.rpmTopic.scoreList;

                        if (scoreList != undefined && scoreList.length > 0 && scoreList[1] != undefined){
                            return scoreList[1].rsScore;
                        }
                        return '';
                    }}
                , { title: '专家2 意见',templet:function(d){
                        var scoreList = d.rpmTopic.scoreList;

                        if (scoreList != undefined && scoreList.length > 0 && scoreList[1] != undefined){
                            return scoreList[1].remarks;
                        }
                        return '';
                    }}
                , { title: '专家3 评分',templet:function(d){
                        var scoreList = d.rpmTopic.scoreList;

                        if (scoreList != undefined && scoreList.length > 0 && scoreList[2] != undefined){
                            return scoreList[2].rsScore;
                        }
                        return '';
                    }}
                , { title: '专家3 意见',templet:function(d){
                        var scoreList = d.rpmTopic.scoreList;

                        if (scoreList != undefined && scoreList.length > 0 && scoreList[2] != undefined){
                            return scoreList[2].remarks;
                        }
                        return '';
                    }}
                , { title: '专家4 评分',templet:function(d){
                        var scoreList = d.rpmTopic.scoreList;

                        if (scoreList != undefined && scoreList.length > 0 && scoreList[3] != undefined){
                            return scoreList[3].rsScore;
                        }
                        return '';
                    }}
                , { title: '专家4 意见',templet:function(d){
                        var scoreList = d.rpmTopic.scoreList;

                        if (scoreList != undefined && scoreList.length > 0 && scoreList[3] != undefined){
                            return scoreList[3].remarks;
                        }
                        return '';
                    }}
                , { title: '平均分',templet:function(d){
                        var avg = d.rpmTopic.avg;
                        if (avg != undefined){
                            return avg;
                        }
                        return '';
                    }}
                , {field: 'type', title: '操作', toolbar: '#barDemo'}
            ]]
            ,parseData:function(res){
                return {
                    "code":0, //解析接口状态
                    "data": res.object //解析数据列表
                };
            }
        });

        //监听行工具事件
        table.on('tool(test)', function(obj){
            var data = obj.data;
            var name = data.rpmTopic.rpmSignatures;
            var nameId = ''
            if(name != undefined){
                for(var i=0;i<name.length;i++){
                    if(name[i].name != ''){
                        nameId += name[i].userName +','
                    }
                }
            } else {
                nameId = ''
            }
            if(obj.event === 'score'){
                layer.open({
                    type: 1,
                    title: '查看',
                    btn: ['确定', '取消'],
                    shade: 0.5,
                    area: ['40%', '40%'],
                    content:'<div style="margin: 10px;">\n' +
                        '    <form class="layui-form" action="">\n' +
                        '        <div class="layui-form-item">\n' +
                        '            <label class="layui-form-label" style="width: 100px;">项目名称</label>\n' +
                        '            <div class="layui-input-block">\n' +
                        '                <input type="text" name="title" lay-verify="title" autocomplete="off" value="'+data.rpmTopic.topicName+'"  class="layui-input" style="width: 60%;border: none">\n' +
                        '            </div>\n' +
                        '        </div>\n' +
                        '        <div class="layui-form-item">\n' +
                        '            <label class="layui-form-label" style="width: 100px;">申报计划名称</label>\n' +
                        '            <div class="layui-input-block">\n' +
                        '                <input type="text" name="title" lay-verify="title" autocomplete="off" value="'+data.rpmTopic.planName+'"   class="layui-input" style="width: 60%;border: none">\n' +
                        '            </div>\n' +
                        '        </div>\n' +
                        '        <div class="layui-form-item">\n' +
                        '            <label class="layui-form-label" style="width: 100px;">项目成员</label>\n' +
                        '            <div class="layui-input-block">\n' +
                        '                <input type="text" name="title" lay-verify="title" autocomplete="off"  value="'+nameId+'" class="layui-input" style="width: 60%;border: none">\n' +
                        '            </div>\n' +
                        '        </div>\n' +
                        '        <div class="layui-form-item">\n' +
                        '            <label class="layui-form-label" style="width: 100px;">负责人</label>\n' +
                        '            <div class="layui-input-block">\n' +
                        '                <input type="text" name="title" lay-verify="title" autocomplete="off"  value="'+data.rpmTopic.userName+'"  class="layui-input" style="width: 60%;border: none">\n' +
                        '            </div>\n' +
                        '        </div>\n' +
                        '   </form>\n' +
                        '</div>'
                })
            }
        });
    });
</script>
